<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="author" content="Alexander.Li">
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<title>登录后台</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
	<link rel="stylesheet" type="text/css" href="/static/css/my-login.css">
</head>
<body class="my-login-page">
	<section class="h-100">
		<div class="container h-100">
			<div class="row justify-content-md-center h-100">
				<div class="card-wrapper">
					<div class="brand">
						<img src="/static/img/logo.jpeg">
					</div>
					<div class="card fat">
						<div class="card-body">
							<h4 class="card-title">管理后台登录</h4>
							<form method="POST" class="login">

								<div class="form-group">
									<label for="email">登录邮箱地址</label>

									<input id="email" type="email" class="form-control" name="email" value="" required autofocus>
								</div>

								<div class="form-group">
									<label for="password">登录密码
										<a href="javascript:void(0)" onclick="alert('忘了密码?找李大哥三');" class="float-right">
											Forgot Password?
										</a>
									</label>
									<input id="password" type="password" class="form-control" name="password" required data-eye>
								</div>

								<div class="form-group no-margin">
									<button type="submit" class="btn btn-primary btn-block">
										登录
									</button>
								</div>
								<div class="margin-top20 text-center">
									Don't have an account? <a href="javascript:void(0)" onclick="alert('想要帐号?还是找李大哥三')">Create One</a>
								</div>
							</form>
						</div>
					</div>
					<div class="footer">
						Copyright &copy; 2018 &mdash; Alexander.Li
					</div>
				</div>
			</div>
		</div>
	</section>
    <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
    <script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
	<script src="/static/js/my-login.js"></script>
    <script>
        $(function () {
            $('.login').submit(function (e) {
                e.preventDefault();
                $.post('{{ url_for("admin.do_login") }}', $(this).serialize(), function (resp) {
                   if (resp.code === 200){
                       alert("登录成功");
                       location.href = '{{ url_for("admin.main") }}';
                   }else{
                       alert(resp.error)
                   }
                }, 'json')
            });
        })
    </script>
</body>
</html>